{{extend "systems_layout.html"}}

{{block content_main}}
{{use "jquery", ui=True}}
{{use "jqutils", hoverIntent=True}}
<div class="content_main">
    <div class="tabnav">
        <ul>
            <li><a href="#" rel="#basic-info" class="tabitem">系统基本信息</a></li>
            <li><a href="#" rel="#selfdev" class="tabitem">自主研发目标管理</a></li>
            <li><a href="/systems/{{=object.id}}/functions" rel="" class="tabitem iframe" fw="100%" fh="550px">系统功能点</a></li>
            <li>
                <div class="hover-menu">
                  <cite>查看<b></b></cite>
                  <ul class="items">
                    <li><a href="/tasks/develop/list?task_sys={{=object.id}}">查看开发任务</a></li>
                    <li><a href="/tasks/nondevelop/list?task_sys={{=object.id}}">查看非开发任务</a></li>
                    <li><a href="/resource/usage?system={{=object.id}}">查看人员情况</a></li>
                  </ul>
                </div>
            </li>
        </ul>
    </div>
    <script type="text/javascript">
        $(function(){
            $('.tabnav').mytabs({'container':'div.content_main', current:{{=tab_id}}, ajax:false});
            $('.hover-menu').hover_menu();
        });
    </script>
    <div id="basic-info" class="box-body col_14">
        {{embed view}}
        <div style="padding:5px;">
        {{if request.user.is_superuser or object._manager_ == request.user.id:}}
        <a class="btn btn-green" href="/systems/{{=object.id}}/edit">编辑</a>
        {{pass}}
        {{if has_role(request.user,'selfdev_manager') and object.selfdev_if:}}
        <a class="btn btn-green" id="selfdev_modified" href="#">不参与系统自主率考核</a>
        {{pass}}
        {{if has_role(request.user,'selfdev_manager') and not object.selfdev_if:}}
        <a class="btn btn-green" id="selfdev_modified" href="#">参与系统自主率考核</a>
        {{pass}}
        <script type="text/javascript">
        $(function(){
                $('#selfdev_modified').click(function(event){
                    event.preventDefault();
                    $.ajax({
                        type: "POST",
                        data: {resource:'system', object_id:{{=object.id}}},
                        url: "/selfdevs/selfdev_if/modified",
                        success: function(data){
                            show_message(data.msg);
                            if(data.selfdev_modified){
                                $('#selfdev_modified').html(data.selfdev_modified);
                                }
                            if(data.selfdev_if){
                                $('#selfdev_if').html(data.selfdev_if);
                            }
                        }
                    });
                });
                
            });
        </script>
        
        <!-- 
        {{if request.user.is_superuser or object._manager_ == request.user.id:}}
        <a class="btn btn-blue" href="/systems/{{=object.id}}/details_add">填写每月资源投入</a>
        {{pass}}
         -->
        {{if request.user.is_superuser:}}
        <a class="btn btn-green" href="/systems/{{=object.id}}/delete" onclick="return confirm('确定要删除当前记录吗？');">删除</a>
        {{pass}}
        </div>
    </div>
    <div id="selfdev" class="box-body col_14">
        <div id="selfdevs">
            <script type="text/javascript">
            $(function(){
                <!--  $('#selfdevs').load("/selfdevs/{{=object.id}}/view");-->
                $.ajax({
                    type: "POST",
                    url: "/selfdevs/{{=object.id}}/view",
                    success: function(data){
                        $('#selfdevs').html(data);
                    }
                });   
            });
            </script>  
        </div>    
        <div style="padding:5px;">
            {{if request.user.is_superuser or has_role(request.user,'selfdev_manager'):}}
            <a class="btn btn-green" href="/selfdevs/{{=object.id}}/edit">编辑</a>
            {{pass}}
            {{if request.user.is_superuser:}}
            <a class="btn btn-green" href="/selfdevs/{{=object.id}}/delete" onclick="return confirm('确定要删除当前记录吗？');">删除</a>
            {{pass}}
        </div>
    </div>
</div>

{{end}}
